SRC = $(wildcard *.s)
OBJ = $(SRC:%.s=%.o) 
BIN = $(OBJ:%.o=%)

AS = as
CC = ld

LDFLAGS = -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -lc
ASFLAGS = --32

clean : $(OBJ)
	rm $^
cleanall : 
	rm $(BIN) $(OBJ)
cpuid2.o : cpuid2.s
	$(AS) $(ASFLAGS) -o $@ $<
cpuid.o : cpuid.s

cpuid2 : cpuid2.o
	$(CC) $(LDFLAGS) -o $@ $<
cpuid : cpuid.o
all : cpuid2 cpuid clean
